Left Termination of the query pattern merge_in_3(g, g, a) w.r.t. the given Prolog program could successfully be proven:



Prolog
  ↳ PrologToPiTRSProof

Clauses:

merge(X, [], X).
merge([], X, X).
merge(.(A, X), .(B, Y), .(A, Z)) :- ','(le(A, B), merge(X, .(B, Y), Z)).
merge(.(A, X), .(B, Y), .(B, Z)) :- ','(gt(A, B), merge(.(A, X), Y, Z)).
gt(s(X), s(Y)) :- gt(X, Y).
gt(s(X), zero).
le(s(X), s(Y)) :- le(X, Y).
le(zero, s(Y)).
le(zero, zero).

Queries:

merge(g,g,a).

We use the technique of [30]. With regard to the inferred argument filtering the predicates were used in the following modes:
merge_in: (b,b,f)
le_in: (b,b)
gt_in: (b,b)
Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

merge_in_gga(X, [], X) → merge_out_gga(X, [], X)
merge_in_gga([], X, X) → merge_out_gga([], X, X)
merge_in_gga(.(A, X), .(B, Y), .(A, Z)) → U1_gga(A, X, B, Y, Z, le_in_gg(A, B))
le_in_gg(s(X), s(Y)) → U6_gg(X, Y, le_in_gg(X, Y))
le_in_gg(zero, s(Y)) → le_out_gg(zero, s(Y))
le_in_gg(zero, zero) → le_out_gg(zero, zero)
U6_gg(X, Y, le_out_gg(X, Y)) → le_out_gg(s(X), s(Y))
U1_gga(A, X, B, Y, Z, le_out_gg(A, B)) → U2_gga(A, X, B, Y, Z, merge_in_gga(X, .(B, Y), Z))
merge_in_gga(.(A, X), .(B, Y), .(B, Z)) → U3_gga(A, X, B, Y, Z, gt_in_gg(A, B))
gt_in_gg(s(X), s(Y)) → U5_gg(X, Y, gt_in_gg(X, Y))
gt_in_gg(s(X), zero) → gt_out_gg(s(X), zero)
U5_gg(X, Y, gt_out_gg(X, Y)) → gt_out_gg(s(X), s(Y))
U3_gga(A, X, B, Y, Z, gt_out_gg(A, B)) → U4_gga(A, X, B, Y, Z, merge_in_gga(.(A, X), Y, Z))
U4_gga(A, X, B, Y, Z, merge_out_gga(.(A, X), Y, Z)) → merge_out_gga(.(A, X), .(B, Y), .(B, Z))
U2_gga(A, X, B, Y, Z, merge_out_gga(X, .(B, Y), Z)) → merge_out_gga(.(A, X), .(B, Y), .(A, Z))

The argument filtering Pi contains the following mapping:
merge_in_gga(x1, x2, x3)  =  merge_in_gga(x1, x2)
[]  =  []
merge_out_gga(x1, x2, x3)  =  merge_out_gga(x3)
.(x1, x2)  =  .(x1, x2)
U1_gga(x1, x2, x3, x4, x5, x6)  =  U1_gga(x1, x2, x3, x4, x6)
le_in_gg(x1, x2)  =  le_in_gg(x1, x2)
s(x1)  =  s(x1)
U6_gg(x1, x2, x3)  =  U6_gg(x3)
zero  =  zero
le_out_gg(x1, x2)  =  le_out_gg
U2_gga(x1, x2, x3, x4, x5, x6)  =  U2_gga(x1, x6)
U3_gga(x1, x2, x3, x4, x5, x6)  =  U3_gga(x1, x2, x3, x4, x6)
gt_in_gg(x1, x2)  =  gt_in_gg(x1, x2)
U5_gg(x1, x2, x3)  =  U5_gg(x3)
gt_out_gg(x1, x2)  =  gt_out_gg
U4_gga(x1, x2, x3, x4, x5, x6)  =  U4_gga(x3, x6)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog



↳ Prolog
  ↳ PrologToPiTRSProof
PiTRS
      ↳ DependencyPairsProof

Pi-finite rewrite system:
The TRS R consists of the following rules:

merge_in_gga(X, [], X) → merge_out_gga(X, [], X)
merge_in_gga([], X, X) → merge_out_gga([], X, X)
merge_in_gga(.(A, X), .(B, Y), .(A, Z)) → U1_gga(A, X, B, Y, Z, le_in_gg(A, B))
le_in_gg(s(X), s(Y)) → U6_gg(X, Y, le_in_gg(X, Y))
le_in_gg(zero, s(Y)) → le_out_gg(zero, s(Y))
le_in_gg(zero, zero) → le_out_gg(zero, zero)
U6_gg(X, Y, le_out_gg(X, Y)) → le_out_gg(s(X), s(Y))
U1_gga(A, X, B, Y, Z, le_out_gg(A, B)) → U2_gga(A, X, B, Y, Z, merge_in_gga(X, .(B, Y), Z))
merge_in_gga(.(A, X), .(B, Y), .(B, Z)) → U3_gga(A, X, B, Y, Z, gt_in_gg(A, B))
gt_in_gg(s(X), s(Y)) → U5_gg(X, Y, gt_in_gg(X, Y))
gt_in_gg(s(X), zero) → gt_out_gg(s(X), zero)
U5_gg(X, Y, gt_out_gg(X, Y)) → gt_out_gg(s(X), s(Y))
U3_gga(A, X, B, Y, Z, gt_out_gg(A, B)) → U4_gga(A, X, B, Y, Z, merge_in_gga(.(A, X), Y, Z))
U4_gga(A, X, B, Y, Z, merge_out_gga(.(A, X), Y, Z)) → merge_out_gga(.(A, X), .(B, Y), .(B, Z))
U2_gga(A, X, B, Y, Z, merge_out_gga(X, .(B, Y), Z)) → merge_out_gga(.(A, X), .(B, Y), .(A, Z))

The argument filtering Pi contains the following mapping:
merge_in_gga(x1, x2, x3)  =  merge_in_gga(x1, x2)
[]  =  []
merge_out_gga(x1, x2, x3)  =  merge_out_gga(x3)
.(x1, x2)  =  .(x1, x2)
U1_gga(x1, x2, x3, x4, x5, x6)  =  U1_gga(x1, x2, x3, x4, x6)
le_in_gg(x1, x2)  =  le_in_gg(x1, x2)
s(x1)  =  s(x1)
U6_gg(x1, x2, x3)  =  U6_gg(x3)
zero  =  zero
le_out_gg(x1, x2)  =  le_out_gg
U2_gga(x1, x2, x3, x4, x5, x6)  =  U2_gga(x1, x6)
U3_gga(x1, x2, x3, x4, x5, x6)  =  U3_gga(x1, x2, x3, x4, x6)
gt_in_gg(x1, x2)  =  gt_in_gg(x1, x2)
U5_gg(x1, x2, x3)  =  U5_gg(x3)
gt_out_gg(x1, x2)  =  gt_out_gg
U4_gga(x1, x2, x3, x4, x5, x6)  =  U4_gga(x3, x6)


Using Dependency Pairs [1,30] we result in the following initial DP problem:
Pi DP problem:
The TRS P consists of the following rules:

MERGE_IN_GGA(.(A, X), .(B, Y), .(A, Z)) → U1_GGA(A, X, B, Y, Z, le_in_gg(A, B))
MERGE_IN_GGA(.(A, X), .(B, Y), .(A, Z)) → LE_IN_GG(A, B)
LE_IN_GG(s(X), s(Y)) → U6_GG(X, Y, le_in_gg(X, Y))
LE_IN_GG(s(X), s(Y)) → LE_IN_GG(X, Y)
U1_GGA(A, X, B, Y, Z, le_out_gg(A, B)) → U2_GGA(A, X, B, Y, Z, merge_in_gga(X, .(B, Y), Z))
U1_GGA(A, X, B, Y, Z, le_out_gg(A, B)) → MERGE_IN_GGA(X, .(B, Y), Z)
MERGE_IN_GGA(.(A, X), .(B, Y), .(B, Z)) → U3_GGA(A, X, B, Y, Z, gt_in_gg(A, B))
MERGE_IN_GGA(.(A, X), .(B, Y), .(B, Z)) → GT_IN_GG(A, B)
GT_IN_GG(s(X), s(Y)) → U5_GG(X, Y, gt_in_gg(X, Y))
GT_IN_GG(s(X), s(Y)) → GT_IN_GG(X, Y)
U3_GGA(A, X, B, Y, Z, gt_out_gg(A, B)) → U4_GGA(A, X, B, Y, Z, merge_in_gga(.(A, X), Y, Z))
U3_GGA(A, X, B, Y, Z, gt_out_gg(A, B)) → MERGE_IN_GGA(.(A, X), Y, Z)

The TRS R consists of the following rules:

merge_in_gga(X, [], X) → merge_out_gga(X, [], X)
merge_in_gga([], X, X) → merge_out_gga([], X, X)
merge_in_gga(.(A, X), .(B, Y), .(A, Z)) → U1_gga(A, X, B, Y, Z, le_in_gg(A, B))
le_in_gg(s(X), s(Y)) → U6_gg(X, Y, le_in_gg(X, Y))
le_in_gg(zero, s(Y)) → le_out_gg(zero, s(Y))
le_in_gg(zero, zero) → le_out_gg(zero, zero)
U6_gg(X, Y, le_out_gg(X, Y)) → le_out_gg(s(X), s(Y))
U1_gga(A, X, B, Y, Z, le_out_gg(A, B)) → U2_gga(A, X, B, Y, Z, merge_in_gga(X, .(B, Y), Z))
merge_in_gga(.(A, X), .(B, Y), .(B, Z)) → U3_gga(A, X, B, Y, Z, gt_in_gg(A, B))
gt_in_gg(s(X), s(Y)) → U5_gg(X, Y, gt_in_gg(X, Y))
gt_in_gg(s(X), zero) → gt_out_gg(s(X), zero)
U5_gg(X, Y, gt_out_gg(X, Y)) → gt_out_gg(s(X), s(Y))
U3_gga(A, X, B, Y, Z, gt_out_gg(A, B)) → U4_gga(A, X, B, Y, Z, merge_in_gga(.(A, X), Y, Z))
U4_gga(A, X, B, Y, Z, merge_out_gga(.(A, X), Y, Z)) → merge_out_gga(.(A, X), .(B, Y), .(B, Z))
U2_gga(A, X, B, Y, Z, merge_out_gga(X, .(B, Y), Z)) → merge_out_gga(.(A, X), .(B, Y), .(A, Z))

The argument filtering Pi contains the following mapping:
merge_in_gga(x1, x2, x3)  =  merge_in_gga(x1, x2)
[]  =  []
merge_out_gga(x1, x2, x3)  =  merge_out_gga(x3)
.(x1, x2)  =  .(x1, x2)
U1_gga(x1, x2, x3, x4, x5, x6)  =  U1_gga(x1, x2, x3, x4, x6)
le_in_gg(x1, x2)  =  le_in_gg(x1, x2)
s(x1)  =  s(x1)
U6_gg(x1, x2, x3)  =  U6_gg(x3)
zero  =  zero
le_out_gg(x1, x2)  =  le_out_gg
U2_gga(x1, x2, x3, x4, x5, x6)  =  U2_gga(x1, x6)
U3_gga(x1, x2, x3, x4, x5, x6)  =  U3_gga(x1, x2, x3, x4, x6)
gt_in_gg(x1, x2)  =  gt_in_gg(x1, x2)
U5_gg(x1, x2, x3)  =  U5_gg(x3)
gt_out_gg(x1, x2)  =  gt_out_gg
U4_gga(x1, x2, x3, x4, x5, x6)  =  U4_gga(x3, x6)
U5_GG(x1, x2, x3)  =  U5_GG(x3)
U1_GGA(x1, x2, x3, x4, x5, x6)  =  U1_GGA(x1, x2, x3, x4, x6)
U6_GG(x1, x2, x3)  =  U6_GG(x3)
LE_IN_GG(x1, x2)  =  LE_IN_GG(x1, x2)
MERGE_IN_GGA(x1, x2, x3)  =  MERGE_IN_GGA(x1, x2)
U2_GGA(x1, x2, x3, x4, x5, x6)  =  U2_GGA(x1, x6)
U4_GGA(x1, x2, x3, x4, x5, x6)  =  U4_GGA(x3, x6)
U3_GGA(x1, x2, x3, x4, x5, x6)  =  U3_GGA(x1, x2, x3, x4, x6)
GT_IN_GG(x1, x2)  =  GT_IN_GG(x1, x2)

We have to consider all (P,R,Pi)-chains

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
PiDP
          ↳ DependencyGraphProof

Pi DP problem:
The TRS P consists of the following rules:

MERGE_IN_GGA(.(A, X), .(B, Y), .(A, Z)) → U1_GGA(A, X, B, Y, Z, le_in_gg(A, B))
MERGE_IN_GGA(.(A, X), .(B, Y), .(A, Z)) → LE_IN_GG(A, B)
LE_IN_GG(s(X), s(Y)) → U6_GG(X, Y, le_in_gg(X, Y))
LE_IN_GG(s(X), s(Y)) → LE_IN_GG(X, Y)
U1_GGA(A, X, B, Y, Z, le_out_gg(A, B)) → U2_GGA(A, X, B, Y, Z, merge_in_gga(X, .(B, Y), Z))
U1_GGA(A, X, B, Y, Z, le_out_gg(A, B)) → MERGE_IN_GGA(X, .(B, Y), Z)
MERGE_IN_GGA(.(A, X), .(B, Y), .(B, Z)) → U3_GGA(A, X, B, Y, Z, gt_in_gg(A, B))
MERGE_IN_GGA(.(A, X), .(B, Y), .(B, Z)) → GT_IN_GG(A, B)
GT_IN_GG(s(X), s(Y)) → U5_GG(X, Y, gt_in_gg(X, Y))
GT_IN_GG(s(X), s(Y)) → GT_IN_GG(X, Y)
U3_GGA(A, X, B, Y, Z, gt_out_gg(A, B)) → U4_GGA(A, X, B, Y, Z, merge_in_gga(.(A, X), Y, Z))
U3_GGA(A, X, B, Y, Z, gt_out_gg(A, B)) → MERGE_IN_GGA(.(A, X), Y, Z)

The TRS R consists of the following rules:

merge_in_gga(X, [], X) → merge_out_gga(X, [], X)
merge_in_gga([], X, X) → merge_out_gga([], X, X)
merge_in_gga(.(A, X), .(B, Y), .(A, Z)) → U1_gga(A, X, B, Y, Z, le_in_gg(A, B))
le_in_gg(s(X), s(Y)) → U6_gg(X, Y, le_in_gg(X, Y))
le_in_gg(zero, s(Y)) → le_out_gg(zero, s(Y))
le_in_gg(zero, zero) → le_out_gg(zero, zero)
U6_gg(X, Y, le_out_gg(X, Y)) → le_out_gg(s(X), s(Y))
U1_gga(A, X, B, Y, Z, le_out_gg(A, B)) → U2_gga(A, X, B, Y, Z, merge_in_gga(X, .(B, Y), Z))
merge_in_gga(.(A, X), .(B, Y), .(B, Z)) → U3_gga(A, X, B, Y, Z, gt_in_gg(A, B))
gt_in_gg(s(X), s(Y)) → U5_gg(X, Y, gt_in_gg(X, Y))
gt_in_gg(s(X), zero) → gt_out_gg(s(X), zero)
U5_gg(X, Y, gt_out_gg(X, Y)) → gt_out_gg(s(X), s(Y))
U3_gga(A, X, B, Y, Z, gt_out_gg(A, B)) → U4_gga(A, X, B, Y, Z, merge_in_gga(.(A, X), Y, Z))
U4_gga(A, X, B, Y, Z, merge_out_gga(.(A, X), Y, Z)) → merge_out_gga(.(A, X), .(B, Y), .(B, Z))
U2_gga(A, X, B, Y, Z, merge_out_gga(X, .(B, Y), Z)) → merge_out_gga(.(A, X), .(B, Y), .(A, Z))

The argument filtering Pi contains the following mapping:
merge_in_gga(x1, x2, x3)  =  merge_in_gga(x1, x2)
[]  =  []
merge_out_gga(x1, x2, x3)  =  merge_out_gga(x3)
.(x1, x2)  =  .(x1, x2)
U1_gga(x1, x2, x3, x4, x5, x6)  =  U1_gga(x1, x2, x3, x4, x6)
le_in_gg(x1, x2)  =  le_in_gg(x1, x2)
s(x1)  =  s(x1)
U6_gg(x1, x2, x3)  =  U6_gg(x3)
zero  =  zero
le_out_gg(x1, x2)  =  le_out_gg
U2_gga(x1, x2, x3, x4, x5, x6)  =  U2_gga(x1, x6)
U3_gga(x1, x2, x3, x4, x5, x6)  =  U3_gga(x1, x2, x3, x4, x6)
gt_in_gg(x1, x2)  =  gt_in_gg(x1, x2)
U5_gg(x1, x2, x3)  =  U5_gg(x3)
gt_out_gg(x1, x2)  =  gt_out_gg
U4_gga(x1, x2, x3, x4, x5, x6)  =  U4_gga(x3, x6)
U5_GG(x1, x2, x3)  =  U5_GG(x3)
U1_GGA(x1, x2, x3, x4, x5, x6)  =  U1_GGA(x1, x2, x3, x4, x6)
U6_GG(x1, x2, x3)  =  U6_GG(x3)
LE_IN_GG(x1, x2)  =  LE_IN_GG(x1, x2)
MERGE_IN_GGA(x1, x2, x3)  =  MERGE_IN_GGA(x1, x2)
U2_GGA(x1, x2, x3, x4, x5, x6)  =  U2_GGA(x1, x6)
U4_GGA(x1, x2, x3, x4, x5, x6)  =  U4_GGA(x3, x6)
U3_GGA(x1, x2, x3, x4, x5, x6)  =  U3_GGA(x1, x2, x3, x4, x6)
GT_IN_GG(x1, x2)  =  GT_IN_GG(x1, x2)

We have to consider all (P,R,Pi)-chains
The approximation of the Dependency Graph [30] contains 3 SCCs with 6 less nodes.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
PiDP
                ↳ UsableRulesProof
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

GT_IN_GG(s(X), s(Y)) → GT_IN_GG(X, Y)

The TRS R consists of the following rules:

merge_in_gga(X, [], X) → merge_out_gga(X, [], X)
merge_in_gga([], X, X) → merge_out_gga([], X, X)
merge_in_gga(.(A, X), .(B, Y), .(A, Z)) → U1_gga(A, X, B, Y, Z, le_in_gg(A, B))
le_in_gg(s(X), s(Y)) → U6_gg(X, Y, le_in_gg(X, Y))
le_in_gg(zero, s(Y)) → le_out_gg(zero, s(Y))
le_in_gg(zero, zero) → le_out_gg(zero, zero)
U6_gg(X, Y, le_out_gg(X, Y)) → le_out_gg(s(X), s(Y))
U1_gga(A, X, B, Y, Z, le_out_gg(A, B)) → U2_gga(A, X, B, Y, Z, merge_in_gga(X, .(B, Y), Z))
merge_in_gga(.(A, X), .(B, Y), .(B, Z)) → U3_gga(A, X, B, Y, Z, gt_in_gg(A, B))
gt_in_gg(s(X), s(Y)) → U5_gg(X, Y, gt_in_gg(X, Y))
gt_in_gg(s(X), zero) → gt_out_gg(s(X), zero)
U5_gg(X, Y, gt_out_gg(X, Y)) → gt_out_gg(s(X), s(Y))
U3_gga(A, X, B, Y, Z, gt_out_gg(A, B)) → U4_gga(A, X, B, Y, Z, merge_in_gga(.(A, X), Y, Z))
U4_gga(A, X, B, Y, Z, merge_out_gga(.(A, X), Y, Z)) → merge_out_gga(.(A, X), .(B, Y), .(B, Z))
U2_gga(A, X, B, Y, Z, merge_out_gga(X, .(B, Y), Z)) → merge_out_gga(.(A, X), .(B, Y), .(A, Z))

The argument filtering Pi contains the following mapping:
merge_in_gga(x1, x2, x3)  =  merge_in_gga(x1, x2)
[]  =  []
merge_out_gga(x1, x2, x3)  =  merge_out_gga(x3)
.(x1, x2)  =  .(x1, x2)
U1_gga(x1, x2, x3, x4, x5, x6)  =  U1_gga(x1, x2, x3, x4, x6)
le_in_gg(x1, x2)  =  le_in_gg(x1, x2)
s(x1)  =  s(x1)
U6_gg(x1, x2, x3)  =  U6_gg(x3)
zero  =  zero
le_out_gg(x1, x2)  =  le_out_gg
U2_gga(x1, x2, x3, x4, x5, x6)  =  U2_gga(x1, x6)
U3_gga(x1, x2, x3, x4, x5, x6)  =  U3_gga(x1, x2, x3, x4, x6)
gt_in_gg(x1, x2)  =  gt_in_gg(x1, x2)
U5_gg(x1, x2, x3)  =  U5_gg(x3)
gt_out_gg(x1, x2)  =  gt_out_gg
U4_gga(x1, x2, x3, x4, x5, x6)  =  U4_gga(x3, x6)
GT_IN_GG(x1, x2)  =  GT_IN_GG(x1, x2)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

GT_IN_GG(s(X), s(Y)) → GT_IN_GG(X, Y)

R is empty.
Pi is empty.
We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

GT_IN_GG(s(X), s(Y)) → GT_IN_GG(X, Y)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
PiDP
                ↳ UsableRulesProof
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

LE_IN_GG(s(X), s(Y)) → LE_IN_GG(X, Y)

The TRS R consists of the following rules:

merge_in_gga(X, [], X) → merge_out_gga(X, [], X)
merge_in_gga([], X, X) → merge_out_gga([], X, X)
merge_in_gga(.(A, X), .(B, Y), .(A, Z)) → U1_gga(A, X, B, Y, Z, le_in_gg(A, B))
le_in_gg(s(X), s(Y)) → U6_gg(X, Y, le_in_gg(X, Y))
le_in_gg(zero, s(Y)) → le_out_gg(zero, s(Y))
le_in_gg(zero, zero) → le_out_gg(zero, zero)
U6_gg(X, Y, le_out_gg(X, Y)) → le_out_gg(s(X), s(Y))
U1_gga(A, X, B, Y, Z, le_out_gg(A, B)) → U2_gga(A, X, B, Y, Z, merge_in_gga(X, .(B, Y), Z))
merge_in_gga(.(A, X), .(B, Y), .(B, Z)) → U3_gga(A, X, B, Y, Z, gt_in_gg(A, B))
gt_in_gg(s(X), s(Y)) → U5_gg(X, Y, gt_in_gg(X, Y))
gt_in_gg(s(X), zero) → gt_out_gg(s(X), zero)
U5_gg(X, Y, gt_out_gg(X, Y)) → gt_out_gg(s(X), s(Y))
U3_gga(A, X, B, Y, Z, gt_out_gg(A, B)) → U4_gga(A, X, B, Y, Z, merge_in_gga(.(A, X), Y, Z))
U4_gga(A, X, B, Y, Z, merge_out_gga(.(A, X), Y, Z)) → merge_out_gga(.(A, X), .(B, Y), .(B, Z))
U2_gga(A, X, B, Y, Z, merge_out_gga(X, .(B, Y), Z)) → merge_out_gga(.(A, X), .(B, Y), .(A, Z))

The argument filtering Pi contains the following mapping:
merge_in_gga(x1, x2, x3)  =  merge_in_gga(x1, x2)
[]  =  []
merge_out_gga(x1, x2, x3)  =  merge_out_gga(x3)
.(x1, x2)  =  .(x1, x2)
U1_gga(x1, x2, x3, x4, x5, x6)  =  U1_gga(x1, x2, x3, x4, x6)
le_in_gg(x1, x2)  =  le_in_gg(x1, x2)
s(x1)  =  s(x1)
U6_gg(x1, x2, x3)  =  U6_gg(x3)
zero  =  zero
le_out_gg(x1, x2)  =  le_out_gg
U2_gga(x1, x2, x3, x4, x5, x6)  =  U2_gga(x1, x6)
U3_gga(x1, x2, x3, x4, x5, x6)  =  U3_gga(x1, x2, x3, x4, x6)
gt_in_gg(x1, x2)  =  gt_in_gg(x1, x2)
U5_gg(x1, x2, x3)  =  U5_gg(x3)
gt_out_gg(x1, x2)  =  gt_out_gg
U4_gga(x1, x2, x3, x4, x5, x6)  =  U4_gga(x3, x6)
LE_IN_GG(x1, x2)  =  LE_IN_GG(x1, x2)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

LE_IN_GG(s(X), s(Y)) → LE_IN_GG(X, Y)

R is empty.
Pi is empty.
We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

LE_IN_GG(s(X), s(Y)) → LE_IN_GG(X, Y)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
PiDP
                ↳ UsableRulesProof

Pi DP problem:
The TRS P consists of the following rules:

MERGE_IN_GGA(.(A, X), .(B, Y), .(B, Z)) → U3_GGA(A, X, B, Y, Z, gt_in_gg(A, B))
U1_GGA(A, X, B, Y, Z, le_out_gg(A, B)) → MERGE_IN_GGA(X, .(B, Y), Z)
U3_GGA(A, X, B, Y, Z, gt_out_gg(A, B)) → MERGE_IN_GGA(.(A, X), Y, Z)
MERGE_IN_GGA(.(A, X), .(B, Y), .(A, Z)) → U1_GGA(A, X, B, Y, Z, le_in_gg(A, B))

The TRS R consists of the following rules:

merge_in_gga(X, [], X) → merge_out_gga(X, [], X)
merge_in_gga([], X, X) → merge_out_gga([], X, X)
merge_in_gga(.(A, X), .(B, Y), .(A, Z)) → U1_gga(A, X, B, Y, Z, le_in_gg(A, B))
le_in_gg(s(X), s(Y)) → U6_gg(X, Y, le_in_gg(X, Y))
le_in_gg(zero, s(Y)) → le_out_gg(zero, s(Y))
le_in_gg(zero, zero) → le_out_gg(zero, zero)
U6_gg(X, Y, le_out_gg(X, Y)) → le_out_gg(s(X), s(Y))
U1_gga(A, X, B, Y, Z, le_out_gg(A, B)) → U2_gga(A, X, B, Y, Z, merge_in_gga(X, .(B, Y), Z))
merge_in_gga(.(A, X), .(B, Y), .(B, Z)) → U3_gga(A, X, B, Y, Z, gt_in_gg(A, B))
gt_in_gg(s(X), s(Y)) → U5_gg(X, Y, gt_in_gg(X, Y))
gt_in_gg(s(X), zero) → gt_out_gg(s(X), zero)
U5_gg(X, Y, gt_out_gg(X, Y)) → gt_out_gg(s(X), s(Y))
U3_gga(A, X, B, Y, Z, gt_out_gg(A, B)) → U4_gga(A, X, B, Y, Z, merge_in_gga(.(A, X), Y, Z))
U4_gga(A, X, B, Y, Z, merge_out_gga(.(A, X), Y, Z)) → merge_out_gga(.(A, X), .(B, Y), .(B, Z))
U2_gga(A, X, B, Y, Z, merge_out_gga(X, .(B, Y), Z)) → merge_out_gga(.(A, X), .(B, Y), .(A, Z))

The argument filtering Pi contains the following mapping:
merge_in_gga(x1, x2, x3)  =  merge_in_gga(x1, x2)
[]  =  []
merge_out_gga(x1, x2, x3)  =  merge_out_gga(x3)
.(x1, x2)  =  .(x1, x2)
U1_gga(x1, x2, x3, x4, x5, x6)  =  U1_gga(x1, x2, x3, x4, x6)
le_in_gg(x1, x2)  =  le_in_gg(x1, x2)
s(x1)  =  s(x1)
U6_gg(x1, x2, x3)  =  U6_gg(x3)
zero  =  zero
le_out_gg(x1, x2)  =  le_out_gg
U2_gga(x1, x2, x3, x4, x5, x6)  =  U2_gga(x1, x6)
U3_gga(x1, x2, x3, x4, x5, x6)  =  U3_gga(x1, x2, x3, x4, x6)
gt_in_gg(x1, x2)  =  gt_in_gg(x1, x2)
U5_gg(x1, x2, x3)  =  U5_gg(x3)
gt_out_gg(x1, x2)  =  gt_out_gg
U4_gga(x1, x2, x3, x4, x5, x6)  =  U4_gga(x3, x6)
U1_GGA(x1, x2, x3, x4, x5, x6)  =  U1_GGA(x1, x2, x3, x4, x6)
MERGE_IN_GGA(x1, x2, x3)  =  MERGE_IN_GGA(x1, x2)
U3_GGA(x1, x2, x3, x4, x5, x6)  =  U3_GGA(x1, x2, x3, x4, x6)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof

Pi DP problem:
The TRS P consists of the following rules:

MERGE_IN_GGA(.(A, X), .(B, Y), .(B, Z)) → U3_GGA(A, X, B, Y, Z, gt_in_gg(A, B))
U1_GGA(A, X, B, Y, Z, le_out_gg(A, B)) → MERGE_IN_GGA(X, .(B, Y), Z)
U3_GGA(A, X, B, Y, Z, gt_out_gg(A, B)) → MERGE_IN_GGA(.(A, X), Y, Z)
MERGE_IN_GGA(.(A, X), .(B, Y), .(A, Z)) → U1_GGA(A, X, B, Y, Z, le_in_gg(A, B))

The TRS R consists of the following rules:

gt_in_gg(s(X), s(Y)) → U5_gg(X, Y, gt_in_gg(X, Y))
gt_in_gg(s(X), zero) → gt_out_gg(s(X), zero)
le_in_gg(s(X), s(Y)) → U6_gg(X, Y, le_in_gg(X, Y))
le_in_gg(zero, s(Y)) → le_out_gg(zero, s(Y))
le_in_gg(zero, zero) → le_out_gg(zero, zero)
U5_gg(X, Y, gt_out_gg(X, Y)) → gt_out_gg(s(X), s(Y))
U6_gg(X, Y, le_out_gg(X, Y)) → le_out_gg(s(X), s(Y))

The argument filtering Pi contains the following mapping:
.(x1, x2)  =  .(x1, x2)
le_in_gg(x1, x2)  =  le_in_gg(x1, x2)
s(x1)  =  s(x1)
U6_gg(x1, x2, x3)  =  U6_gg(x3)
zero  =  zero
le_out_gg(x1, x2)  =  le_out_gg
gt_in_gg(x1, x2)  =  gt_in_gg(x1, x2)
U5_gg(x1, x2, x3)  =  U5_gg(x3)
gt_out_gg(x1, x2)  =  gt_out_gg
U1_GGA(x1, x2, x3, x4, x5, x6)  =  U1_GGA(x1, x2, x3, x4, x6)
MERGE_IN_GGA(x1, x2, x3)  =  MERGE_IN_GGA(x1, x2)
U3_GGA(x1, x2, x3, x4, x5, x6)  =  U3_GGA(x1, x2, x3, x4, x6)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPOrderProof

Q DP problem:
The TRS P consists of the following rules:

U1_GGA(A, X, B, Y, le_out_gg) → MERGE_IN_GGA(X, .(B, Y))
MERGE_IN_GGA(.(A, X), .(B, Y)) → U3_GGA(A, X, B, Y, gt_in_gg(A, B))
MERGE_IN_GGA(.(A, X), .(B, Y)) → U1_GGA(A, X, B, Y, le_in_gg(A, B))
U3_GGA(A, X, B, Y, gt_out_gg) → MERGE_IN_GGA(.(A, X), Y)

The TRS R consists of the following rules:

gt_in_gg(s(X), s(Y)) → U5_gg(gt_in_gg(X, Y))
gt_in_gg(s(X), zero) → gt_out_gg
le_in_gg(s(X), s(Y)) → U6_gg(le_in_gg(X, Y))
le_in_gg(zero, s(Y)) → le_out_gg
le_in_gg(zero, zero) → le_out_gg
U5_gg(gt_out_gg) → gt_out_gg
U6_gg(le_out_gg) → le_out_gg

The set Q consists of the following terms:

gt_in_gg(x0, x1)
le_in_gg(x0, x1)
U5_gg(x0)
U6_gg(x0)

We have to consider all (P,Q,R)-chains.
We use the reduction pair processor [15].


The following pairs can be oriented strictly and are deleted.


U1_GGA(A, X, B, Y, le_out_gg) → MERGE_IN_GGA(X, .(B, Y))
MERGE_IN_GGA(.(A, X), .(B, Y)) → U1_GGA(A, X, B, Y, le_in_gg(A, B))
The remaining pairs can at least be oriented weakly.

MERGE_IN_GGA(.(A, X), .(B, Y)) → U3_GGA(A, X, B, Y, gt_in_gg(A, B))
U3_GGA(A, X, B, Y, gt_out_gg) → MERGE_IN_GGA(.(A, X), Y)
Used ordering: Combined order from the following AFS and order.
U1_GGA(x1, x2, x3, x4, x5)  =  U1_GGA(x1, x2)
le_out_gg  =  le_out_gg
MERGE_IN_GGA(x1, x2)  =  x1
.(x1, x2)  =  .(x1, x2)
U3_GGA(x1, x2, x3, x4, x5)  =  U3_GGA(x1, x2)
gt_in_gg(x1, x2)  =  gt_in_gg(x1, x2)
le_in_gg(x1, x2)  =  x1
gt_out_gg  =  gt_out_gg
U6_gg(x1)  =  x1
s(x1)  =  s
zero  =  zero
U5_gg(x1)  =  U5_gg(x1)

Recursive path order with status [2].
Quasi-Precedence:
[leoutgg, s] > gtingg2 > [gtoutgg, zero]
[.2, U3GGA2] > U1GGA2 > [gtoutgg, zero]
[.2, U3GGA2] > gtingg2 > [gtoutgg, zero]
U5gg1 > [gtoutgg, zero]

Status:
U3GGA2: [2,1]
zero: multiset
U1GGA2: multiset
s: multiset
gtingg2: multiset
.2: [2,1]
leoutgg: multiset
gtoutgg: multiset
U5gg1: multiset


The following usable rules [17] were oriented: none



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
                      ↳ QDP
                        ↳ QDPOrderProof
QDP
                            ↳ UsableRulesProof

Q DP problem:
The TRS P consists of the following rules:

MERGE_IN_GGA(.(A, X), .(B, Y)) → U3_GGA(A, X, B, Y, gt_in_gg(A, B))
U3_GGA(A, X, B, Y, gt_out_gg) → MERGE_IN_GGA(.(A, X), Y)

The TRS R consists of the following rules:

gt_in_gg(s(X), s(Y)) → U5_gg(gt_in_gg(X, Y))
gt_in_gg(s(X), zero) → gt_out_gg
le_in_gg(s(X), s(Y)) → U6_gg(le_in_gg(X, Y))
le_in_gg(zero, s(Y)) → le_out_gg
le_in_gg(zero, zero) → le_out_gg
U5_gg(gt_out_gg) → gt_out_gg
U6_gg(le_out_gg) → le_out_gg

The set Q consists of the following terms:

gt_in_gg(x0, x1)
le_in_gg(x0, x1)
U5_gg(x0)
U6_gg(x0)

We have to consider all (P,Q,R)-chains.
As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [15] we can delete all non-usable rules [17] from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
                      ↳ QDP
                        ↳ QDPOrderProof
                          ↳ QDP
                            ↳ UsableRulesProof
QDP
                                ↳ QReductionProof

Q DP problem:
The TRS P consists of the following rules:

MERGE_IN_GGA(.(A, X), .(B, Y)) → U3_GGA(A, X, B, Y, gt_in_gg(A, B))
U3_GGA(A, X, B, Y, gt_out_gg) → MERGE_IN_GGA(.(A, X), Y)

The TRS R consists of the following rules:

gt_in_gg(s(X), s(Y)) → U5_gg(gt_in_gg(X, Y))
gt_in_gg(s(X), zero) → gt_out_gg
U5_gg(gt_out_gg) → gt_out_gg

The set Q consists of the following terms:

gt_in_gg(x0, x1)
le_in_gg(x0, x1)
U5_gg(x0)
U6_gg(x0)

We have to consider all (P,Q,R)-chains.
We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.

le_in_gg(x0, x1)
U6_gg(x0)



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
                      ↳ QDP
                        ↳ QDPOrderProof
                          ↳ QDP
                            ↳ UsableRulesProof
                              ↳ QDP
                                ↳ QReductionProof
QDP
                                    ↳ QDPSizeChangeProof

Q DP problem:
The TRS P consists of the following rules:

MERGE_IN_GGA(.(A, X), .(B, Y)) → U3_GGA(A, X, B, Y, gt_in_gg(A, B))
U3_GGA(A, X, B, Y, gt_out_gg) → MERGE_IN_GGA(.(A, X), Y)

The TRS R consists of the following rules:

gt_in_gg(s(X), s(Y)) → U5_gg(gt_in_gg(X, Y))
gt_in_gg(s(X), zero) → gt_out_gg
U5_gg(gt_out_gg) → gt_out_gg

The set Q consists of the following terms:

gt_in_gg(x0, x1)
U5_gg(x0)

We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs: